<template>
  <div class="box box-ver w-p100 h-p100">
    <div class="box box-ver box-ac w-p100 h-p100">
      <image class="num" src="/static/images/num.png"></image>
      <image @click="reservation()" class="button" src="/static/images/button.png"></image>
    </div>
    <success v-if="status === 1"></success>
    <error v-if="status === 2"></error>
  </div>
</template>

<script>
import success from '@/components/success'
import error from '@/components/error'
import { mapState } from 'vuex'
export default {
  data () {
    return {
      userInfo: {}
    }
  },
  computed: mapState(['data', 'status']),
  components: {
    success,
    error
  },

  methods: {
    getUserInfo () {
      // 调用登录接口
      wx.login({
        success: () => {
          wx.getUserInfo({
            success: (res) => {
              this.userInfo = res.userInfo
            }
          })
        }
      })
    },
    reservation () {
      this.$store.commit('status', 1)
    }
  },
  created () {
    // 调用应用实例的方法获取全局数据
    this.getUserInfo()
  }
}
</script>

<style scoped>
.num{
  margin-top:160rpx;
  width:513rpx;
  height:124rpx;
}
.button{
  margin-top:127rpx;
  width:430rpx;
  height:430rpx;
}
</style>
